#{extends 'main.html' /}
#{set title:'Mes cours' /}
#{set 'moreStyles'}
		#{stylesheet 'form_modal.css' /}
		#{stylesheet 'upload_img.css' /}
		#{stylesheet 'jquery.dataTables_themeroller.css' /}
		#{stylesheet 'jquery-ui-1.8.4.custom.css' /}
		#{stylesheet 'demo_table_jui.css' /}
#{/set}
#{set 'moreScripts'}
	#{script 'jquery.dataTables.min.js' /}
#{/set}

<!-- The JavaScript -->	

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
#{script 'itv_all_request.js' /}
<script type="text/javascript" >
 	$(function(){
		var aDataSet = [

		    		];
 		
        $('#actionsBox .box_action_delete').bind('click',function(e){
            var ids = new Array(); 
            $('#mytable input:checked').each(function(e,i){
                var $this = $(this);
               ids.push($this.val());               
            });
            var listAction = #{jsAction @delete(':id') /};
            $.get(listAction({id: ids}),
            		   function(){
            	for(var i= 0; i < ids.length; i++)
            	{
                	$("tr[id="+ids[i]+"]").remove();
            	}
              });
        }); 
        
    	$(document).ready(function() {    		
    		$('#example').dataTable({
				"aaData": [
							#{list listIntervention, as:'intervention'}
							[" ",
							 '${intervention.enseignantIntervention}', 
							 '${intervention.subjectIntervention}',
							 '${intervention.beginDateIntervention.format("dd/MM/yyyy")}',
							 '${intervention.endDateIntervention.format("dd/MM/yyyy")}',
							 '${intervention.statutIntervention.libelle}'],
							#{/list}				           
				           
				           ],
				"aoColumns": [
					{ "sTitle": "" },
					{ "sTitle": "Enseignant" },
					{ "sTitle": "Intitulé" },
					{ "sTitle": "Début"},
					{ "sTitle": "Fin"},
					{ "sTitle": "Statut" }
				],
				"bJQueryUI": true,
		        "sPaginationType": "full_numbers",
		        "oLanguage": {
		            "sLengthMenu": "Afficher _MENU_ entrées",
		            "sZeroRecords": "Aucun cours créé",
		            "sInfo": "Résultat : _START_ à _END_ de _TOTAL_ cours",
		            "sInfoEmpty": "Affichage de 0 à 0 sur 0 cours",
		            "sInfoFiltered": "(Affichage de _MAX_ cours au total)"
		        }
    		});
    	} );
 	});
	
</script>

<section>
	<div id="container_data">
		<div class="row">
			<div class="span10 offset1">
			<div class="span2"><a href="@{Interventions.exportExcel()}">Exporter en Excel</a></div>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>
<!-- 				<ul id="mytable" class="table table-hover">
					#{if listIntervention == null}
						<li>
							<td rowspan="6">Aucun cours cr&eacute;e</td>
						</li>
					#{/if}
					#{list listIntervention, as:'intervention'}
						<li id="${intervention.id}">
							<div class="row">
							<div class="span">
								<input  id="check_${intervention.id}" name="${intervention.subjectIntervention}" type="checkbox" value="${intervention.id}" AUTOCOMPLETE=OFF />
							</div>
							#{if session['user_statut'] == "Student"}
							<div class="span1">	
									<img class="img-polaroid" src="@{Interventions.image(intervention.enseignantIntervention.id)}"/>
							</div>	
							#{/if}
							<div class="span4">
								<h3>${intervention.subjectIntervention}</h3>
								<br/>
								<small>
									par
									<a href="/Profil/${intervention.enseignantIntervention.id}/${intervention.enseignantIntervention.lastNameUser +' '+intervention.enseignantIntervention.firstNameUser}">
										${intervention.enseignantIntervention.lastNameUser} 
										${intervention.enseignantIntervention.firstNameUser}
									</a>
								</small>
							</div>
							
							#{if session['user_statut'] == "Enseignant"}
								<strong>Formation</strong><br>
								${intervention.formationIntervention.libelleFormation}
								<br>
							#{/if}
							<strong>P&eacute;riode</strong> :
							Du ${intervention.beginDateIntervention.format('dd/MM/yyyy')} au
							${intervention.endDateIntervention.format('dd/MM/yyyy')}<br>
							<strong>Statut</strong> :
							${intervention.statutIntervention.libelle}
							</div>
						</li>
					#{/list}		
				</ul>  -->
			
<!-- 				<table id="mytable" class="table table-hover"> -->
<!-- 					<thead> -->
<!-- 						<tr> -->
<!-- 							<th></th> -->
<!-- 							<th>Mati&eacute;re</th> -->
<!-- 							#{if session['user_statut'] == "Student"} -->
<!-- 							<th>Enseignant</th> -->
<!-- 							#{/if} -->
<!-- 							#{if session['user_statut'] == "Enseignant"} -->
<!-- 							<th>Formation</th> -->
<!-- 							#{/if} -->
<!-- 							<th>Date de d&eacute;but</th> -->
<!-- 							<th>Date de fin</th> -->
<!-- 							<th>Statut</th> -->
<!-- 						</tr> -->
<!-- 					</thead> -->
				
<!-- 					<tbody> -->
<!-- 					#{if listIntervention == null} -->
<!-- 						<tr> -->
<!-- 							<td rowspan="6">Aucun cours cr&eacute;e</td> -->
<!-- 						</tr> -->
<!-- 					#{/if} -->
<!-- 					#{list listIntervention, as:'intervention'} -->
<!-- 						<tr id="${intervention.id}"> -->
<!-- 							<td class="check"><input id="check_${intervention.id}" name="${intervention.subjectIntervention}" type="checkbox" value="${intervention.id}" AUTOCOMPLETE=OFF /></td> -->
<!-- 							<td>${intervention.subjectIntervention}</td> -->
<!-- 							#{if session['user_statut'] == "Student"} -->
<!-- 							<td>${intervention.enseignantIntervention.lastNameUser}</td> -->
<!-- 							#{/if} -->
<!-- 							#{if session['user_statut'] == "Enseignant"} -->
<!-- 							<td>${intervention.formationIntervention.libelleFormation}</td> -->
<!-- 							#{/if} -->
<!-- 							<td>${intervention.beginDateIntervention.format('dd/MM/yyyy')}</td> -->
<!-- 							<td>${intervention.endDateIntervention.format('dd/MM/yyyy')}</td> -->
<!-- 							<td>En cours</td> -->
<!-- 						</tr> -->
<!-- 					#{/list} -->
<!-- 					</tbody>		 -->
<!-- 				</table> -->
			</div>
		</div>
	</div>
</section>

<div id="actionsBox" class="actionsBox">
	<!-- #{form @Interventions.itv_display_request()} -->
    <div id="actionsBoxMenu" class="menu">
        <span id="cntBoxMenu">0</span>
        
     <!--   <input type="hidden" name="id" value=""/>
        <input type="hidden" name="subject" value=""/>
        <input class="button box_action_display" type="submit" value="Voir">
         -->
        <a class="button box_action_display">Voir</a>
        #{if session["user_statut"] == "Enseignant"}
        	<a class="button box_action_delete">Supprimer</a>
        #{/if}
        <a id="toggleBoxMenu" class="open"></a>
        <a id="closeBoxMenu" class="button">X</a>
    </div>   
     <!-- #{/form} -->
    <div class="submenu">
        <a class="first box_action">Move...</a>
        <a class="box_action">Mark as read</a>
        <a class="box_action">Mark as unread</a>
        <a class="last box_action">Spam</a>
    </div>
</div>